<?php
class ApiController extends Zend_Controller_Action{
    protected $_arrParam;
    public function init(){
        $this->_arrParam=$this->_request->getParams();        
    }
    public function loadDistrictAction(){
        $params=$this->_arrParam;
        Zend_Loader::loadClass("DistrictModel");
        $districtModel=new DistrictModel();
        $list_district=$districtModel->fetchAll("Province_idProvince='".@$params['idProvince']."'");
        if($list_district){
            foreach ($list_district as $district){
                echo "<option id=".$district['idDistrict'].">".$district['DistrictName']."</option>";
            }
        }
        die;
    }
    public function addRouterAction(){
        $this->_helper->layout()->disableLayout();
        Zend_Loader::loadClass("TransportcompanysModel");
        Zend_Loader::loadClass("ProvinceModel");
        Zend_Loader::loadClass("DistrictModel");
        $provinceModel=new ProvinceModel();
        $list_province=$provinceModel->fetchAll();
        $transportcompanysModel=new TransportcompanysModel();
        $list_transport=$transportcompanysModel->fetchAll();
        $districtModel=new DistrictModel();
        $list_district=$districtModel->fetchAll();
        
        for($i=0;$i<=23;$i++){
        	if($i<10) $arr_hour["0".$i]="0".$i;
        	else $arr_hour[$i]=$i;
        }
        for($i=0;$i<=59;$i++){
        	if($i<10) $arr_minute["0".$i]="0".$i;
        	else $arr_minute[$i]=$i;
        }
        
        $this->view->arr_hour=$arr_hour;
        $this->view->arr_minute=$arr_minute;
        $this->view->list_companys=$list_transport;
        $this->view->list_province=$list_province;
        $this->view->list_district=$list_district;
        $params=$this->_arrParam;
        $this->view->count=$params['count'];
    }
    
}